<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script>
			const obj = {
				name: "test"
			}
			const fishObj = new Proxy(obj, {
				get(target, key) {
					console.log(target, key);
					return target[key];
				},
				set(target, key, value) {
					if (value !== "fish") return console.log("只能设置为fish");
					
					target[key] = value;
				},
			});
			fishObj.name = "特色t"
			console.log(fishObj.name);
		</script>
	</body>
</html>